A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
Recording and playing audio signals are a common part of many computer system applications. A computer system may receive a digital audio signal from a variety of sources, e.g., directly from a digital microphone or a hardware codec, from an analog-to-digital converter connected to an analog audio source, downloaded via a network, or from various digital audio storage media, including CD-ROMs, flash memory, digital tapes, etc. A received digital audio signal may be stored by the computer system, either in memory, or on some other storage media. A stored digital audio signal may then be output, e.g., played using a digital speaker, or transmitted via a network to another computer system.
A digital audio signal may include a sequence of coded xe2x80x9csamples.xe2x80x9d Individual samples may define an output level from a digital sound producing device (e.g., a digital speaker), or the strength of a electrical signal transmitted to an analog speaker at a particular time. The samples may be received individually or in xe2x80x9cblocksxe2x80x9d of multiple samples. The number of samples per unit time in a signal may be referred to as the xe2x80x9csampling ratexe2x80x9d of the signal. For example, standard CD audio sound is recorded at a sampling rate of 44.1 thousand samples per second. Each sample may include one or more coded signals, e.g., two separate signals may be provided in a sample for a two-channel stereo signal. Each sample in a signal may be coded as a binary word of a given length, e.g., 16-bit words are commonly used.
xe2x80x9cDownsamplingxe2x80x9d may be used to play or record a received digital, audio signal at a lower rate than it was received, by dropping samples from the signal. For example a hardware codec might produce a digital audio signal at a rate of 48K samples/sec, while the application being used stores digital audio signals at a rate of 24K samples/second. The 48K sample/sec xe2x80x9cinputxe2x80x9d or xe2x80x9csourcexe2x80x9d digital audio signal could then be downsampled to produce a stored 24K sample/second stored or xe2x80x9coutputxe2x80x9d digital audio signal. Downsampling may be accomplished by removing samples from the received input digital audio signal. Downsampling may produce a lower rate output digital audio signal in the same format as the original input signal. Storing a signal at a lower rate may save significant amounts of storage space, which may be at a premium, particularly in an embedded system. A downsampled signal may be played at the lower output sampling rate. Alternatively, a downsampled signal may be xe2x80x9cupsampledxe2x80x9d to produce a higher rate digital audio signal.
When a stored digital audio signal is received by the computer system, for example by retrieving it from a storage media, the signal may be xe2x80x9cupsampledxe2x80x9d or converted to a higher sampling rate than the stored signal by adding samples to the signal. The upsampled signal may have the same format as the received signal. Upsampling may be needed where an output device only can process a signal at a given rate, e.g., 44.1 KHz, and the received digital audio signal has been recorded by the computer system at a lower rate, e.g., 8 KHz.
A theoretical analysis of upsampling and downsampling is provided in A. V. Oppenheim, and R. W. Schafer, DISCRETE-TIME SIGNAL PROCESSING, Prentice Hall, 1989 and also in S. K. Mitra, DIGITAL SIGNAL PROCESSING, McGraw-Hill, 1998. Conventional upsampling methods use specialized hardware or make intensive use of floating point operations in order to interpolate or otherwise reconstruct the missing samples that may be provided when a received signal is upsampled. Using specialized hardware has several disadvantages. Extra hardware adds to the cost, size, and power consumption of a computer system. Furthermore, many specialized hardware units may be able to upsample only to a particular fixed output rate, making the computer system less flexible, or requiring different pieces of hardware for different rates. Software upsampling, while more flexible than hardware upsampling, may require a large number of floating point operations. Particularly in so-called xe2x80x9cembedded computer systemsxe2x80x9d, computing capacity may be limited and floating-point hardware may not be included. If the computer system does not have a floating point processor, simulating floating point operations with a fixed point processor may be extremely computationally intensive.
In accordance with an example embodiment of the present invention, a method is provided that includes (a) receiving a first digital audio signal including samples and having a first sampling rate, (b) outputting at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being higher than the first sampling rate, (c) incrementing a counter for each sample from the first digital audio signal that is output as part of the second digital audio signal, (d) when the counter exceeds a threshold number, inserting at least one synthetic sample as part of the second digital audio signal, and (e) repeating (b), (c), and (d), until all the samples in the first digital audio signal have been output.
Also in accordance with an example embodiment of the present invention, a system is provided that includes a counter, a threshold, and an upsampling mechanism, the upsampling mechanism configured (a) to receive a first digital audio signal including samples and having a first sampling rate, (b) to output at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the desired second sampling rate being greater than the first sampling rate, (c) to increment the counter for each sample from the first digital audio signal that is output as part of the second digital audio signal in (b), (d) when the counter exceeds the threshold, to insert at least one synthetic sample as part of the second digital audio signal, and (e) to repeat (b), (c), and (d) until all samples in the first digital audio signal have been output.
Also in accordance with an example embodiment of the present invention, an article of manufacture is provided, the article of manufacture including a computer-readable medium having stored thereon instructions adapted to be executed by a processor, the instructions which, when executed, define a series of steps to be used to control a method for upsampling a digital audio signal, the steps including: receiving a first digital audio signal including samples and having a first sampling rate, outputting at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being higher than the first sampling rate, incrementing a counter for each sample from the first digital audio signal that is output as part of the second digital audio signal, when the counter exceeds a threshold number, inserting at least one synthetic sample as part of the second digital audio signal, and repeating the steps of outputting, incrementing, and inserting, until all the samples in the first digital audio signal have been output.
Also in accordance with an example embodiment of the present invention, a method of downsampling a digital audio signal is provided that includes (a) receiving a first digital audio signal including samples and having a first sampling rate, (b) outputting at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being less than the first sampling rate, (c) incrementing a counter for each sample from the first digital audio signal that is output as part of the second digital audio signal, (d) when the counter exceeds a threshold number, skipping at least one sample from the first digital audio signal; and (e) repeating (b), (c) and (d) until all the samples in the first digital audio signal have been output or skipped.
Also in accordance with an example embodiment of the present invention, a system is provided that includes a counter, a threshold number, and a downsampling mechanism, the downsampling mechanism configured (a) to receive a first digital audio signal, the first digital audio signal including samples and having a first sampling rate, (b) to output at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being less than the first sampling rate, (c) to increment a counter for each sample from the first digital audio signal that is output as part of the second digital audio signal, (d) when the counter exceeds the threshold number, to skip at least one sample from the first digital audio signal, and (e) to repeat (b), (c), and (d), until all samples in the first digital audio signal have been output or skipped.
Also in accordance with an example embodiment of the present invention, an article of manufacture is provided, the article of manufacture including a computer-readable medium having stored thereon instructions adapted to be executed by a processor, the instructions which, when executed, define a series of steps to be used to control a method for downsampling a digital audio signal, said steps including receiving a first digital audio signal including samples and having a first sampling rate, outputting at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being less than the first sampling rate, incrementing a counter for each sample from the first digital audio signal that is output as part of the second digital audio signal, when the counter exceeds a threshold number, skipping at least one sample from the first digital audio signal, and repeating the steps of outputting, incrementing and skipping until all the samples in the first digital audio signal have been output or skipped.
Also in accordance with an example embodiment of the present invention, a method of receiving and playing back a digital audio signal is provided, the method including, (a) receiving a first digital audio signal including samples and having a first sampling rate, (b) storing at least one sample from the first digital audio signal as part of a second digital audio signal, the second digital audio signal having a desired second sampling rate, the second sampling rate being less than the first sampling rate, (c) incrementing a first counter for each sample from the first digital audio signal that is stored as part of the second digital audio signal, (d) when the first counter exceeds a first threshold number, skipping at least one sample from the first digital audio signal, (e) repeating (b), (c) and (d) until all the samples in the first digital audio signal have been output or skipped, (f) retrieving the second digital audio signal, (g) outputting at least one sample from the second digital audio signal as part of a third digital audio signal, the third digital audio signal having a desired third sampling rate, the third sampling rate being higher than the second sampling rate, (h) incrementing a second counter for each sample from the second digital audio signal that is output as part of the third digital audio signal, (i) when the second counter exceeds a second threshold number, inserting at least one synthetic sample as part of the third digital audio signal; and (j) repeating (g), (h), and (i), until all the samples in the second digital audio signal have been output.